package org.qydjk.common.constant;

/**
 * 微信默认数据
 */
public class WechatConstant {
    /**
     * 微信预支付接口
     */
    public static final String WECHAT_PREPAY_URL = "https://api.mch.weixin.qq.com/pay/unifiedorder";

    /**
     * GET
     *
     * 获取access_token接口地址:APPID、APPSECRET
     *
     * grant_type 获取access_token填写client_credential appid 第三方用户唯一凭证 secret
     * 第三方用户唯一凭证密钥，即appsecret {"access_token":"ACCESS_TOKEN","expires_in":7200}
     * {"errcode":40013,"errmsg":"invalid appid"}
     */
    public static final String ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";

    /**
     * GET
     *
     * 获取js_api接口地址:ACCESS_TOKEN
     *
     * { "errcode":0, "errmsg":"ok", "ticket":
     * "bxLdikRXVbTPdHSM05e5u5sUoXNKd8-41ZO3MhKoyN5OfkWITDGgnr2fwJ0m9E8NYzWKVZvdVtaUgWvsdshFKA"
     * , "expires_in":7200 }
     */
    public static final String JS_API_URL = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=ACCESS_TOKEN&type=jsapi";

    /**
     * POST
     *
     * 创建自定义菜单接口地址：ACCESS_TOKEN
     *
     * {"errcode":0,"errmsg":"ok"}
     * {"errcode":40018,"errmsg":"invalid button name size"}
     */
    public static final String CREARE_MENU_URL = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token=ACCESS_TOKEN";

    /**
     * POST
     *
     * 模板消息：ACCESS_TOKEN
     *
     * {"errcode":0,"errmsg":"ok","msgid":200228332}
     *
     */
    public static final String TEMPLATE_MESSAGE_URL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN";

    /**
     * POST
     *
     * 生成带参二维码第一步：生成ticket:ACCESS_TOKEN
     *
     * 临时二维码：{"expire_seconds": 604800, "action_name": "QR_SCENE","action_info": {"scene": {"scene_id": 123}}}
     * 永久二维码：{"action_name":"QR_LIMIT_SCENE", "action_info": {"scene": {"scene_id": 123}}}
     * 永久二维码：{"action_name": "QR_LIMIT_STR_SCENE", "action_info": {"scene":{"scene_str": "123"}}}
     *
     * {"ticket":
     * "gQH47joAAAAAAAAAASxodHRwOi8vd2VpeGluLnFxLmNvbS9xL2taZ2Z3TVRtNzJXV1Brb3ZhYmJJAAIEZ23sUwMEmm3sUw=="
     * ,"expire_seconds":60,"url":
     * "http:\/\/weixin.qq.com\/q\/kZgfwMTm72WWPkovabbI"}
     */
    public static final String CREATE_QRCODE_TICKET_URL = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=ACCESS_TOKEN";

    /**
     * GET
     *
     * 生成带参二维码第二步：根据ticket直接下载二维码:ACCESS_TOKEN
     *
     * 提醒：TICKET记得进行UrlEncode
     */
    public static final String CREATE_QRCODE_URL = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=TICKET";

    /**
     * 微信授权第一步，构建微信授权的地址：APPID、REDIRECTURI、STATE
     *
     * REDIRECTURI必须要进行URL_ENCODE STATE自己定义
     */
    public static final String AUTH_USERINFO_URL = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=APPID&redirect_uri=REDIRECTURI&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";

    /**
     * 微信授权第二步，根据code获取openid和access_token（和正常使用的access_token不同）：APPID、APPSECRET
     * 、CODE
     *
     */
    public static final String GET_OPENID_ACCESSTOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=APPSECRET&code=CODE&grant_type=authorization_code";

    /**
     * 微信授权第三步，根据access_token和openid获取用户基本信息：ACCESS_TOKEN、OPENID
     *
     */
    public static final String GET_USER_INFO_URL = "https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN";

    /**
     * 根据access_token和openid获取用户基本信息：ACCESS_TOKEN、OPENID(不需要授权)
     *
     */
    public static final String GET_USERINFO_URL = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID";
}
